/**
 */
package fUML.Semantics.Activities.IntermediateActivities;

import fUML.Semantics.Classes.Kernel.Value;

import org.eclipse.emf.ecore.EObject;

/**
 * <!-- begin-user-doc -->
 * A representation of the model object '<em><b>Token</b></em>'.
 * <!-- end-user-doc -->
 *
 * <!-- begin-model-doc -->
 * A token is an individual element of data or control that may flow across an
 *                 activity edge.
 * <!-- end-model-doc -->
 *
 * <p>
 * The following features are supported:
 * <ul>
 *   <li>{@link fUML.Semantics.Activities.IntermediateActivities.Token#getHolder <em>Holder</em>}</li>
 * </ul>
 * </p>
 *
 * @see fUML.Semantics.Activities.IntermediateActivities.IntermediateActivitiesPackage#getToken()
 * @model abstract="true"
 * @generated
 */
public interface Token extends EObject {
	/**
	 * Returns the value of the '<em><b>Holder</b></em>' container reference.
	 * It is bidirectional and its opposite is '{@link fUML.Semantics.Activities.IntermediateActivities.ActivityNodeActivation#getHeldTokens <em>Held Tokens</em>}'.
	 * <!-- begin-user-doc -->
	 * <p>
	 * If the meaning of the '<em>Holder</em>' container reference isn't clear,
	 * there really should be more of a description here...
	 * </p>
	 * <!-- end-user-doc -->
	 * @return the value of the '<em>Holder</em>' container reference.
	 * @see #setHolder(ActivityNodeActivation)
	 * @see fUML.Semantics.Activities.IntermediateActivities.IntermediateActivitiesPackage#getToken_Holder()
	 * @see fUML.Semantics.Activities.IntermediateActivities.ActivityNodeActivation#getHeldTokens
	 * @model opposite="heldTokens" transient="false" ordered="false"
	 * @generated
	 */
	ActivityNodeActivation getHolder();

	/**
	 * Sets the value of the '{@link fUML.Semantics.Activities.IntermediateActivities.Token#getHolder <em>Holder</em>}' container reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Holder</em>' container reference.
	 * @see #getHolder()
	 * @generated
	 */
	void setHolder(ActivityNodeActivation value);

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // if this token does not have any holder, make the given holder its
	 *                   holder.
	 *  // Otherwise, remove this token from its holder and return a copy
	 *                   of it transfered to a new holder.
	 *  
	 *  Token token = this;
	 *                   if (this.holder != null) {
	 *  this.withdraw();
	 *  token =
	 *                   this.copy();
	 *  }
	 *  
	 *  token.holder = holder;
	 *  return
	 *                   token;
	 *  
	 * <!-- end-model-doc -->
	 * @model required="true" ordered="false" holderRequired="true" holderOrdered="false"
	 * @generated
	 */
	Token transfer(ActivityNodeActivation holder);

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Remove this token from its holder, withdrawing any offers for it.
	 *                   
	 *  if (!this.isWithdrawn()) {
	 *  // Debug.println("[withdraw] Taking
	 *                   token with value = " + this.getValue());
	 *                   this.holder.removeToken(this);
	 *  this.holder = null;
	 *  }
	 *                 
	 * <!-- end-model-doc -->
	 * @model
	 * @generated
	 */
	void withdraw();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * Test if this token is equal to another token.
	 *  
	 * <!-- end-model-doc -->
	 * @model required="true" ordered="false" otherRequired="true" otherOrdered="false"
	 * @generated
	 */
	boolean equals(Token other);

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Make a copy of this token.
	 *  
	 * <!-- end-model-doc -->
	 * @model required="true" ordered="false"
	 * @generated
	 */
	Token copy();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Test if this token has been withdrawn.
	 *  
	 *  return
	 *                   this.holder == null;
	 *  
	 * <!-- end-model-doc -->
	 * @model kind="operation" required="true" ordered="false"
	 * @generated
	 */
	boolean isWithdrawn();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * Test whether this is a control token.
	 *  
	 * <!-- end-model-doc -->
	 * @model kind="operation" required="true" ordered="false"
	 * @generated
	 */
	boolean isControl();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * Get the value associated with this token (if any).
	 * <!-- end-model-doc -->
	 * @model kind="operation" ordered="false"
	 * @generated
	 */
	Value getValue();

} // Token
